package yh.plugins.workflow.system;

import java.sql.Connection;
import java.sql.Statement;
import java.util.Map;

import yh.core.funcs.workflow.util.YHIWFHookPlugin;

public class YHDemoInternet implements YHIWFHookPlugin{

	  /* 
	   * 审核通过则修改状态
	   * (non-Javadoc)
	 * @see yh.core.funcs.workflow.util.YHIWFHookPlugin#execute(java.sql.Connection, int, java.util.Map, java.util.Map, boolean)
	 */
	@Override
	  public String execute(Connection dbConn, int runId, Map arrayHandler, Map formData, boolean agree) throws Exception {
		  	
		
		   ////{"KEY":"业务主键","NETIZEN_NAME":"业务网民名称","CONTENT":"业务提交内容","REMARK":"业务提交描述","SUBMIT_DATE":"业务提交日期","FTYPE":"业务状态"}
		   //可以得到审批表单中的值：
	     String NETIZEN_NAME =(String)arrayHandler.get("NETIZEN_NAME");
         String CONTENT=(String)arrayHandler.get("CONTENT");
         String REMARK=(String)arrayHandler.get("REMARK");
         String SUBMIT_DATE=(String)arrayHandler.get("SUBMIT_DATE");
         String remove_reason=(String)arrayHandler.get("REASON");
         System.out.println("业务网民名称:"+NETIZEN_NAME+"--业务提交内容:"+CONTENT+"--业务提交描述:"+REMARK+"--业务提交日期:"+SUBMIT_DATE);
    //可以获取映射内容进行其他操作，此处忽略，只对状态更新
         if(agree) {   
			String seqId = (String) arrayHandler.get("KEY");//管理表id
			Statement st  = null;
			
			try{
				st = dbConn.createStatement();
				//更新财务应收单的状态为“已完成”
				String sql = "update demo_internet_form set ftype = '2' where seq_id='"+seqId+"'";
				st.executeUpdate(sql);
			}
			catch (Exception e) {
				dbConn.rollback();
				throw e;
			}
         }
			return null;
	  }
	}
